#ifndef ZOOMABLEPREVIEW_H
#define ZOOMABLEPREVIEW_H

#include <QGraphicsView>
#include <QGraphicsScene>

class ZoomablePreview : public QGraphicsView
{
    Q_OBJECT

public:
    explicit ZoomablePreview(QWidget* parent = nullptr);
    void setImage(const QImage& image);
    void updateImageKeepView(const QImage& image);

protected:
    void wheelEvent(QWheelEvent* event) override;
    void mousePressEvent(QMouseEvent* event) override;
    void mouseMoveEvent(QMouseEvent* event) override;
    void mouseReleaseEvent(QMouseEvent* event) override;

private:
    QGraphicsScene* m_scene;
    QPointF m_lastPos;
    bool m_isDragging = false;
};

#endif // ZOOMABLEPREVIEW_H 